package com.soft863.tc.common.constant;

import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.ResourceBundle;

public class ConfigConstant {
    private static final Map<String, String> configs = new HashMap<>();

    static {
        //国际化
        ResourceBundle resourceBundle = ResourceBundle.getBundle("ct");
        Enumeration<String> enums = resourceBundle.getKeys();
        while (enums.hasMoreElements()) {
            String key = enums.nextElement();
            String value = resourceBundle.getString(key);
            configs.put(key, value);
        }
    }

    public static String getVal(String key) {
        return configs.getOrDefault(key, "error");
    }

    public static void main(String[] args) {
        System.out.println( ConfigConstant.getVal("ct.cf.caller"));
    }
}
